#ifndef _TIMER_H_
#define _TIMER_H_

// includes
//----------
#include <ctime>
#include <iostream>


/*!
* @brief This class measures the process time.
* @author Andre Pereira
*/
class Timer
{
private: 
  clock_t m_start;
  clock_t m_time;
  const double m_CPS;

public:
  Timer( ) : m_start( clock( ) ), m_CPS( double( CLOCKS_PER_SEC ) )
  { m_time = m_start; };
  ~Timer( ) { ; };
  double measure( )
  {
    clock_t old_time = m_time;
    m_time = clock( );
    const double seconds = static_cast< double >( m_time - old_time ) / m_CPS;
    return seconds;
  };
  double appendTime( )
  {
    m_time = clock( );
    const double seconds = static_cast< double >( m_time - m_start ) / m_CPS;
    return seconds;
  };
  double measureTotal( )
  {
    m_time = clock( );
    const double seconds = static_cast< double >( m_time - m_start ) / m_CPS;
    return seconds;
  };
};



#endif  //_TIMER_H_

